#pragma once

#include "LayerBase.h"
#include "CommonUiUtil.h"
#include "ui/UIListView.h"

class CLayerUserInfo : public CLayerBase {
public:
	CLayerUserInfo(void);
	virtual ~CLayerUserInfo(void);
	CREATE_FUNC(CLayerUserInfo);

	bool init() override;
	virtual void onEnter() override;
	//virtual void onExit() override;
	virtual void update(float delta) override;
private:
	void onClose(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onHighProperty(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onSkillBattle(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onSkillLife(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);

	void onBInit(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onBUp(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onBDown(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onBUpgrade(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);

	void onLInit(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);
	void onLUpgrade(cocos2d::Ref* pSender, cocos2d::ui::Widget::TouchEventType type);

	void updateBaseInfo();
	cocos2d::Node* swapPage(cocos2d::Node* page, const char* src);
	void initProperty1(cocos2d::Node* node, int32_t tag, const std::string& key, int32_t value);
	void initProperty2(cocos2d::Node* node, int32_t tag, const std::string& key, int32_t value);
	void initPoint(cocos2d::Node* node, int32_t tag, const std::string& key, int32_t value);
private:
	CILogicPerson*				m_User;
	cocos2d::Node*				m_Info;

	cocos2d::Node*				m_CurPage;
	cocos2d::Node*				m_HighProperty;
	cocos2d::Node*				m_BattleSkill;
	cocos2d::Node*				m_LifeSkill;

	CCommonUiUtil::VecNode_t	m_BListItems;
	cocos2d::ui::ListView*		m_BList;
	CCommonUiUtil::VecNode_t	m_LListItems;
	cocos2d::ui::ListView*		m_LList;
};

